import { lazy } from 'react';
import type { CustomRouteObject } from './types';

// 导入路由组件（使用懒加载）
const Home = lazy(() => import('../pages/home/Index'));
const PrevView = lazy(() => import('../pages/prevView/Index'));
const NotFound = lazy(() => import('../pages/NotFound'));
const App = lazy(() => import('../layout/Layout'));
const PrevApp = lazy(() => import('../layout/PrevLayout'));

// 定义路由配置
const routes: CustomRouteObject[] = [
  {
    path: '/',
    element: <App />,
    meta: {
      title: '主页布局',
    },
    children: [
      {
        index: true,
        element: <Home />,
        meta: {
          title: '首页',
          icon: 'home',
        },
      },
    ],
  },
  {
    path: '/prevView',
    element: <PrevApp />,
    meta: {
      title: '主页布局',
    },
    children: [
      {
        index: true,
        element: <PrevView />,
        meta: {
          title: '关于我们',
          icon: 'info',
        },
      },
    ],
  },
  {
    path: '*',
    element: <NotFound />,
    meta: {
      title: '404 - 页面未找到',
      hideInMenu: true,
    },
  },
];

export default routes;
